//定义一个XMLHttpRequest对象
var xmlHttp;
function createHttpRequest() {
	// IE7+,谷歌,火狐...浏览器
	if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
		// alert("window.XMLHttpRequest");
	} else {
		// window.ActiveXObject;IE5,IE6
		xmlHttp = new ActiveXObject();
		// alert("window.ActiveXObject");
	}
}
function fun1() {
	var bigtypeid = document.all.bigType.value;
	var smallType = document.all.smallType;
	smallType.length = 0;
	if (bigtypeid == 0) {
		return;
	}
	createHttpRequest();
	var url = "SelectTypeServlet?bigtypeid=" + bigtypeid + "&date="
			+ new Date().getTime();
	xmlHttp.open("get", url, true);
	// 绑定一个javaScript函数，处理请求状态改变
	xmlHttp.onreadystatechange = function() {
		// 请求完成
		if (xmlHttp.readyState == 4) {
			// 状态码200正常请求响应
			if (xmlHttp.status = 200) {
				var xml = xmlHttp.responseXML;
				var smallTypeArr = xml.getElementsByTagName("smalltype");
				for (var i = 0; i < smallTypeArr.length; i++) {
					var nid = smallTypeArr[i].childNodes[0].childNodes[0].nodeValue;
					var sname = smallTypeArr[i].childNodes[1].childNodes[0].nodeValue;
					var opt = new Option(sname, nid);
					smallType.add(opt);
				}
			}
		}
	};
	xmlHttp.send(null);
}